{%extends "base.html"%}
{%block body%}
  <h1>{{ name }}</h1>
  <table id="run_result" width="500" border="1">
    <tr>
      <th>call</th>
      <th>expected</th>
      <th>got</th>
      <th>status</th>
    </tr>
    {% for result in results %}
    <tr>
      {% for item in result %}
      {% if item %}
      <td {% ifequal item "pass" %} class="pass" {% endifequal %}>{{ item }}</td>
      {% else %}
      <td {% ifequal item "fail" %} class="fail" {% endifequal %}>{{ item }}</td>
      {% endif %}
      {% endfor %}
    </tr>
    {% endfor %}
  </table>
{%endblock%}

{% block scripts %}
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.3.1");
google.setOnLoadCallback(function() {
  $('table.run_result tbody tr td:last-child').each( function(){
      if  ($(this).text() == 'fail'){
          $(this).parent().addClass('failure')
      }
      else if  ($(this).text() == 'pass'){
          $(this).parent().addClass('success')
      }
  });
});
</script>
{% endblock %}
